package Hotel;

public class Room {
	private int roomid;
	private boolean state;
	private Guest guest;
	
	public Room(int roomid){
		this.roomid=roomid;
		state=false;
		guest=null;
	}
	
	public Guest getGuest() {
		return guest;
	}

	public void setGuest(Guest guest) {
		this.guest = guest;
	}

	public int getRoomid() {
		return roomid;
	}

	public void setRoomid(int roomid) {
		this.roomid = roomid;
	}

	public boolean isState() {
		return state;
	}

	public void setState(boolean state) {
		this.state = state;
	}

	public boolean checkin(Guest g){
		if(state){
			return false;
		}
		guest=g;
		state=true;
		return  true;  //说明我入主成功了
	}
	
	public boolean checkout(){
		if(state){
			state=false;  //首先把房间改为假，
			return true;
		}
		return false;
	}
	public String toString(){
		
		return roomid+":"+(state?guest.getName():"EMPTY");
	}
}
